<template>
  <div>
    <el-card style="margin:20px">
      <el-table :data="tableData" height="200" border style="width: 1000px; margin:20px">
        <el-table-column
          type="selection"
          width="40"
          fixed
        />
        <el-table-column
          type="index"
          label="序号"
          width="50"
        />
        <el-table-column
          prop="ownerName"
          label="货主名称"
          width="100"
        />
        <el-table-column
          prop="goodsCode"
          label="货品编号"
          width="120"
        />
        <el-table-column
          prop="goodsName"
          label="货品名称"
          width="120"
        />
        <el-table-column
          prop="goodsTpyeName"
          label="货品类型"
          width="150"
        />
        <el-table-column
          prop="goodsPrice"
          label="货品单价(元)"
          width="120"
        />
        <el-table-column
          prop="goodsGuaranteeDay"
          label="保质天数(天)"
          width="120"
        />
        <el-table-column
          prop="goodsUnit"
          label="单位"
          width="120"
        />
        <el-table-column
          prop="goodsVolume"
          label="体积(m^3)"
          width="120"
        />
        <el-table-column
          prop="planNum"
          label="到货数量"
          width="120"
        />
        <el-table-column
          prop="realNum"
          label="实收总数"
          width="120"
        />
        <el-table-column
          prop="realDifferenceNum"
          label="收获差异"
          width="120"
        />

      </el-table>
      <!-- 分页 -->
      <el-row type="flex" justify="center" align="middle" style="height: 60px">
        <el-pagination
          :total="total"
          :page-size="putwayInfo.size"
          layout="total, sizes, prev, pager, next, jumper"
        />
      </el-row>
      <el-row type="flex" justify="center">
        <el-button round type="success" @click="$router.back()">返回</el-button>

      </el-row>
    </el-card>
  </div>
</template>

<script>
import { getReceivingDetail } from '@/api/stork'
export default {
  data() {
    return {
      masterId: '',
      tableData: [],
      putwayInfo: {
        code: '',
        receptCode: '',
        ownerName: '',
        current: 1,
        size: 3
      },
      total: 0
    }
  },
  async created() {
    // 拿到传入的id
    console.log(this.$route.params.id)
    this.masterId = this.$route.params.id
    // 发送请求渲染
    const res = await getReceivingDetail({ masterId: this.masterId })
    console.log(res.data.data.records)
    this.tableData = res.data.data.records
    this.total = res.data.data.records.length
  }
}
</script>

<style>

</style>
